CC=g++
CFLAGS=-Wall
SAMDIR=${HOME}/samtools-0.1.17
REF=/home/lindenb/tmp/TESTCHRM/chrM.fa
FASTQ=/home/lindenb/tmp/TESTCHRM/chrM.fastq

all:test
test:a.out
	./a.out sampe  $(REF) /tmp/jeter2.idx \
		/home/lindenb/tmp/TESTCHRM/fastq1.fq \
		/home/lindenb/tmp/TESTCHRM/fasq2.fq
	
test1:a.out
	./a.out find  $(REF) /tmp/jeter2.idx ataacttaatggtatatttttaaataacttaaagagt
	./a.out find  $(REF) /tmp/jeter2.idx gaactcccgacctcaggtgatacgcccgccgtggcctcccaaagtgctgggattacaggcatgaaccactttacccggccTGCTTGGGGTTCCTTTGAGGCCTT
	./a.out find  $(REF) /tmp/jeter2.idx TCCTTTTCTAAGCTTAATAATATTCTCCTCAAAGTTTCTGATTATTAAGACTTTAATAATCAACTTCTTC
test2:a.out
	./a.out index $(REF) /tmp/jeter2.idx

a.out:genomeindexer.o xstdio.o xstdlib.o xzlib.o xfaidx.o xstring.o bio.o shortread.o
	$(CC) -o $@ $(CFLAGS) genomeindexer.o xstdio.o xstdlib.o xzlib.o xfaidx.o xstring.o bio.o shortread.o -lz
xmmap.o:xmmap.cpp xmmap.h
	$(CC) -c -o $@ $(CFLAGS) $<
genomeindexer.o:genomeindexer.cpp mergesort.h
	$(CC) -c -o $@ $(CFLAGS) $<
xstdio.o:xstdio.cpp xstdio.h
	$(CC) -c -o $@ $(CFLAGS) $<
xstdlib.o:xstdlib.cpp xstdlib.h
	$(CC) -c -o $@ $(CFLAGS) $<
xzlib.o:xzlib.cpp xzlib.h
	$(CC) -c -o $@ $(CFLAGS) $<
xfaidx.o:xfaidx.cpp xfaidx.h
	$(CC) -c -o $@ $(CFLAGS) $<
xstring.o:xstring.cpp xstring.h
	$(CC) -c -o $@ $(CFLAGS) $<
bio.o: bio.cpp bio.h
	$(CC) -c -o $@ $(CFLAGS) $<
shortread.o : shortread.cpp shortread.h
	$(CC) -c -o $@ $(CFLAGS) $<
bam.o:bam.cpp bam.h
	$(CC) -c -o $@ -I$(SAMDIR) $(CFLAGS) $<
	
clean:
	rm -f *.o a.out